import {
  Column,
  CreateDateColumn,
  Entity,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity({ name: 'user' })
export class UserEntity {
  @PrimaryGeneratedColumn()
  id: number;
  /* 手机号 */
  @Column('varchar', {
    nullable: true,
    length: 20,
    select: false,
    unique: true,
  })
  phone: string;

  @Column({
    type: 'varchar',
    nullable: true,
    length: 255,
    select: false,
  })
  password: string;

  /**
   * 名称
   */
  @Column({ length: 45, nullable: true })
  name: string;
  /**
   * 头像
   */
  @Column({ length: 255, nullable: true })
  avatar: string;
  /**
   * 性别 0 保密 1 男 2 女
   */
  @Column('tinyint', { width: 1, default: 0 })
  gender: number;

  /**
   * 国家
   */
  @Column({ length: 60, nullable: true })
  country: string;
  @Column({ length: 60, nullable: true })
  province: string;
  @Column({ length: 60, nullable: true })
  city: string;
  @Column({ length: 60, nullable: true })
  distanct: string;

  @Column({ nullable: true, length: 100 })
  desc: string;
  @Column({ nullable: true, length: 255 })
  create_ip: string;
  @Column({ nullable: true, length: 255 })
  last_login_ip: string;
  @Column({ nullable: true, length: 45, comment: '注册来源' })
  create_where_from: string;
  @Column({ nullable: true, length: 45 })
  status: string;

  @Column({ nullable: true, select: false, length: 100 })
  wxapp_openid: string;
  @Column({ nullable: true, select: false, length: 100 })
  weixin_openid: string;
  @Column({ nullable: true, select: false, length: 100 })
  weixin_unionid: string;

  @Column({ nullable: true, select: false, length: 130 })
  app_push_id: string;
  @Column('tinyint', { nullable: true, width: 1, comment: '1 ios 2 android' })
  app_os: number;
  @Column('int', { nullable: true, width: 5 })
  app_version: number;

  @Column('int', {
    width: 11,
    nullable: true,
    comment: 'member_uid 用于客服IM',
  })
  uid: number;

  @Column('bigint', { width: 13 })
  create_time: number;
  @Column('bigint', { width: 13, nullable: true })
  last_login_time: number;
}
